// pagesProperty/pages/oa/attendance/contacts/index.js
var app = getApp(), fetchApi = require("../../../../utils/httpPost.js")
, common_Js = require("../../../../component/common.js");
import Dialog from '../../../../component/vant/dialog/dialog';
import Toast from '../../../../component/vant/toast/toast';
Page({

  /**
   * 页面的初始数据
   */
  data: {
    keyword:'',
    deptList:[],
    userList:[],
    pageSize:10,
    pageIndex:1,
    isLoading:true,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.onHttpInit()
  },

  onHttpInit: function () {
    var that = this;
    fetchApi.httpPost("/estate/dept/list", {
      pageSize:that.data.pageSize,
      pageIndex: that.data.pageIndex,
      keyword: that.data.keyword,
    }, function (res) {
      console.log("获取通讯录返回数据:", res)
      that.setData({
        deptList: res.data.data.deptList,
        isLoading:false,
      });

    }, function (a) {
      console.log("获取通讯录返回数据 err:", a);
    });
  },
  goShowUser(e){
    var item = e.currentTarget.dataset.item;

    wx.navigateTo({
      url: './user/index?dept_id=' + item.deptId,
    })
  }
  
})